Skip to content

add libretro platform#217

Draft
azaka wants to merge 7 commits into
ButterscotchRunner:mainfrom
azaka:libretro
Draft

add libretro platform#217
azaka wants to merge 7 commits into
ButterscotchRunner:mainfrom
azaka:libretro

Conversation

@azaka

@azaka azaka commented Jun 11, 2026

Copy link
Copy Markdown

Allow the project to be built as a libretro core.

Currently video and input with joystick are tested to work.

Uses software renderer from https://github.com/Un1q32/Butterscotch/tree/software

@Un1q32

Un1q32 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

PRs that require the software renderer should be marked as draft and wait until #128 is merged.

@azaka azaka marked this pull request as draft June 11, 2026 15:49
@azaka

azaka commented Jun 13, 2026

Copy link
Copy Markdown
Author

Audio added. Miniaudio is used as mixing engine

@leap0x7b

Copy link
Copy Markdown

why software renderer? couldn't opengl be used instead?

@Eliandro4

Copy link
Copy Markdown
Contributor

Maybe its cuz the dev wants the core to run on a device without gou

@RicardoFromPortugal

Copy link
Copy Markdown

yeah basically software rendering first, other hw accelerated renderers can be added later down the line

@cobaltgit

cobaltgit commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Yeah I do think the hardware renderers should be integrated into the core aswell, I (as well as the dev) work with handheld gaming devices that don't have 3D GPUs so it makes sense to integrate the software renderer though

@Un1q32

Un1q32 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

If you added OpenGL support it could be merged sooner then if it starts as software only, since it wouldn't need the sw renderer to be useful.

@azaka

azaka commented Jun 24, 2026

Copy link
Copy Markdown
Author

Core is now hardware accelerated through gles3. Building with software rendering is optional.

@Un1q32

Un1q32 commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Do we really need to vendor all that library stuff. Looks very big. Couldn't we just have a workflow that fetches it from wherever you got it from on build time?

@azaka

azaka commented Jun 27, 2026

Copy link
Copy Markdown
Author

I have trim down the lib to only include what's needed

@cobaltgit

Copy link
Copy Markdown
Collaborator

The desktop backend now detects the opengl version at runtime, reckon libretro should too?

@azaka

azaka commented Jun 27, 2026

Copy link
Copy Markdown
Author

The core can request any hardware context that is supported by the frontend and I have tested gles3 so far

@cobaltgit

Copy link
Copy Markdown
Collaborator

Oh goodie then when merged with upstream it should work on the miyoo a30 (OpenGL ES 2.0)

Comment thread src/libretro/libretro.c
}
#endif

#ifdef ENABLE_GLES

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use the ENABLE_GLES macro anymore, use ENABLE_MODERN_GL

Comment thread src/libretro/libretro.c

#ifdef ENABLE_GLES
g_renderer = GLRenderer_create();
GLRenderer* gl = (GLRenderer*)g_renderer;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to initialize isGLES (a bool in the GLRenderer struct) to something. Since presumably you're targetting GLES it should be true, but when you want desktop GL instead (which we should support since retroarch has desktop support) it should be false.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the desktop backend we basically just check glGetString(GL_VERSION) and if it contains "OpenGL ES" then we say we're on GLES. You should probably do something like that.

@cobaltgit

Copy link
Copy Markdown
Collaborator

Oh and it's also hardcoded to link to libGLESv2 etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants